package com.taotao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.TaotaoResult;
import com.taotao.pojo.TbUser;
import com.taotao.sso.service.UserResgisterService;

@Controller
public class UserResgisterController {
	
	@Autowired
	private UserResgisterService service;
	

	/**
	 * url:/user/check/{param}/{type}
	 * 
	 * @param param
	 * @param type
	 * @return
	 */
	@RequestMapping(value="/user/check/{param}/{type}",method=RequestMethod.GET  )
	@ResponseBody
	public TaotaoResult checkData(@PathVariable String param ,@PathVariable Integer type) {
		//1.引入服务
		//2.注入服务
		//3.调用方法
		
		return service.checkData(param, type);
	}
	/**
	 * url:/user/register
	 * username //用户名
	 * password //密码
	 * phone //手机号
	 * email //邮箱
	 * 请求的方法：post
	 * 返回值：json

	 */
	@RequestMapping(value="/user/register",method=RequestMethod.POST)
	@ResponseBody
	public TaotaoResult register(TbUser tbUser) {
		//调用服务
		TaotaoResult result = service.register(tbUser);
		return result;
	}
	
}
